//
//  MYhomeViewCell.swift
//  MYWeiBo
//
//  Created by apple on 16/5/16.
//  Copyright © 2016年 YanMo. All rights reserved.
//

import UIKit
import SnapKit

class MYhomeViewCell: UITableViewCell {
    //给originview中的status赋值
    var status:MYStatus?{
        didSet{
            originalView.status = status
        }
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        //准备ui
        prepareUI()
    }
    func prepareUI(){
        //添加背景
        backgroundColor = UIColor(white: 237/255.0, alpha: 1)
        contentView.addSubview(originalView)
        //加上约束
        originalView.snp_makeConstraints { (make) -> Void in
            make.top.equalTo(contentView).offset(10)
            make.leading.equalTo(contentView)
            make.trailing.equalTo(contentView)
            let height = Int( arc4random_uniform(200)) + 50
            make.height.equalTo(height)
        }
        //约束contenview
        contentView.snp_makeConstraints { (make) -> Void in
            make.top.equalTo(self)
            make.leading.equalTo(self)
            make.trailing.equalTo(self)
            make.bottom.equalTo(originalView)
            
        }
    
    }
///懒加载
    private lazy var originalView:MYStatusOriginalView = MYStatusOriginalView()



}
